// API配置
const API_BASE_URL = process.env.REACT_APP_API_URL || 'http://172.20.0.89:8079';

// 配置版本号 - 用于调试和缓存控制
export const CONFIG_VERSION = '2024-10-13-v7-stop-generation';

export const API_CONFIG = {
    BASE_URL: API_BASE_URL,
    TIMEOUT: 30000, // 30秒超时

    // 聊天相关API
    CHAT_STREAM_URL: `${API_BASE_URL}/item-query/chat/stream`,
    CHAT_CLOSE_URL: `${API_BASE_URL}/item-query/chat/close`,
    CHAT_HISTORY_URL: `${API_BASE_URL}/session/message/history`,

    // 会话管理API - 统一使用 /session 前缀
    CREATE_SESSION_URL: `${API_BASE_URL}/session/create`,
    GET_SESSIONS_URL: `${API_BASE_URL}/session/sessions`,
    DELETE_SESSION_URL: (sessionId) => `${API_BASE_URL}/session/sessions/${sessionId}`,
    UPDATE_SESSION_URL: (sessionId) => `${API_BASE_URL}/session/sessions/${sessionId}`,
    COPY_SESSION_URL: (sessionId) => `${API_BASE_URL}/session/sessions/${sessionId}/copy`,

    // 兼容性：保留旧的函数名
    getSessionDetail: (sessionId) => `${API_BASE_URL}/session/sessions/${sessionId}`,
    copySession: (sessionId) => `${API_BASE_URL}/session/sessions/${sessionId}/copy`,
};

// 消息类型
export const MESSAGE_TYPES = {
    USER: 'user',
    ASSISTANT: 'assistant',
};

// 节点类型
export const NODE_TYPES = {
    INTENT: '意图识别',
    STRUCT: '结构化提取',
    RETRIEVAL: '指标检索',
    ERROR: 'error',
};

// UI配置
export const UI_CONFIG = {
    MAX_MESSAGE_LENGTH: 1000,
    TOOLTIP_DELAY: 200,
    SCROLL_BEHAVIOR: 'smooth',
};

// 默认配置
export const DEFAULT_CONFIG = {
    SESSION_ID_PREFIX: 'chat-session-',
    INTERRUPT_FEEDBACK: '',
    REQUEST_TYPE: 'node_object',
};